﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using CMS.BLL;

public partial class Controls_Cruise_ctrCruiseCatMenu : System.Web.UI.UserControl
{

    private int nCurrentlanguage = Support.GetCurrentLanguage();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        { BindData(); }
    }

    private void BindData()
    {

        City objCity = new City();
        DataTable dtbCity = new DataTable();
        dtbCity = objCity.SearchByCountry(GetCountryID());
        rptMenu.DataSource = dtbCity;
        rptMenu.DataBind();
    }

    private int GetCountryID()
    {
        int nCountry = ConvertData.ConvertToInt(Request.QueryString["cid"]);
        if (nCountry == 0)
            nCountry = 1;

        return nCountry;
    }
    protected void rptMenu_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            HyperLink lnkCity = (HyperLink)e.Item.FindControl("lnkCity");
            int nID = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "CityID"));
            switch (nCurrentlanguage)
            {
                case 1:
                    lnkCity.Text = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "CityName1"));
                    break;
                case 2:
                    lnkCity.Text = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "CityName2"));
                    break;
                case 3:
                    lnkCity.Text = ConvertData.ConvertToString(DataBinder.Eval(e.Item.DataItem, "CityName3"));
                    break;
            }

            lnkCity.NavigateUrl = "~/Hotel.aspx" + "?cid=" + this.GetCountryID() + "&" + Config.CITY + "=" + nID;
        }
    }
}